home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
176-200
/
scopedisk180
/
arexxtutorial
/
string
/
string.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-03-19
|
2KB
|
60 lines
/* print_at function demo
by Jim Ventola June 22, 1988
emulates COMAL's PRINT AT <row, column> command
...with help from SCARY and Bill Hawes */
/* Main Program */
call open("jimsfile","con://640/60/Jim's CONSOLE; used for testing.")
do for 5
call printat(2,13,"This should be at row 2, col 13. Hit return")
call getreturn() /* Did user hit return? */
call printat(10,15,"And this line is at 10, 15. Hit Return")
call getreturn()
call page()
end
call printat(4,14,"All done.")
call getreturn()
exit
/* Internal (User Designed) Functions */
printat:procedure
parse arg row, col, text /* To prevent conversion to upper case
by ARG alone, which means PARSE UPPER ARG */
s1 = (row)
s2 = (col)
outstring = s1 || ';' || s2 || H || text /* Build ANSI coded string */
call writech('jimsfile','9b'x||outstring) /* Write it to CON: file */
return
page:
call writech('jimsfile','0c'x) /* Send formfeed to clear screen */
return
getreturn:
do until char = '0A'x /* OA hex is RETURN key */
char = readch("jimsfile") /* wait for keypress */
end
return
/* Notes
The CON: device responds to ANSI codes, as documented in an appendix
of the Bantam DOS Manual. Hex 9b ('9b'x in ARexx) is the Control
Sequence Introducer (CSI). The docs give:"<CSI>row;columnH" as
the code for positioning the cursor. That is what the outstring is
all about--its assign code produces: '9b'x row;columnH text.
This demo also shows how to make and call an internal function.
Hint: if you get a lot of "unbalanced parentheses" errors
when you can SEE that there are two, check for a space between the
function name and the opening parenthesis. ARexx is very strict
about spaces. */